public class TwoDArray {
    public static void main(String[] args) {
        // 二维数组的声明和初始化
        int[][] matrix = {
            {1, 2, 3},
            {4, 5, 6},
            {7, 8, 9}
        };
        
        // 遍历二维数组
        System.out.println("二维数组内容:");
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                System.out.print(matrix[i][j] + " ");
            }
            System.out.println();
        }
        
        // 另一种方式声明二维数组
        String[][] students = new String[2][3];
        students[0][0] = "张三";
        students[0][1] = "85";
        students[0][2] = "男";
        students[1][0] = "李四";
        students[1][1] = "92";
        students[1][2] = "女";
    }
}
